package com.ea.eadp.nexus.test.workflow.newconsole.register;

import org.openqa.selenium.WebDriver;

import com.ea.eadp.nexus.test.pageDefinition.newconsole.UnderageCreateOriginAccountPage;
import com.ea.eadp.nexus.test.workflow.WorkflowElement;
import com.ea.eadp.nexus.test.workflow.WorkflowElementArgument;

public class UnderageInputParentEmailWorkflowElement extends WorkflowElement {
    
    protected UnderageCreateOriginAccountPage page;
    
    public UnderageInputParentEmailWorkflowElement(
        WebDriver driver, WorkflowElementArgument argument
    ) {
        super(driver, argument);
        page = new UnderageCreateOriginAccountPage(driver);
    }
    
    @Override
    public void init() {
        page.waitPageLoadCompleted();
    }
    
    @Override
    public void doAction() {
        log.info("Enter Parent Email:" + args.parentEmail);
        page.sendInput(UnderageCreateOriginAccountPage.parentEmailInputBox, args.parentEmail);
        page.clickBlank("//div[@id='panel-basic']//span[@class='title']");
        
        log.info("Enter Password:" + args.password);
        page.sendInput(UnderageCreateOriginAccountPage.passwordInputBox, args.password);
        page.clickBlank("//div[@id='panel-basic']//span[@class='title']");
        
        log.info("Enter Confirm Password:" + args.password);
        page.sendInput(UnderageCreateOriginAccountPage.confirmPasswordInputBox, args.password);
        page.clickBlank("//div[@id='panel-basic']//span[@class='title']");
    }
    
    @Override
    public void moveNext() {
        page.sendControllerKey('A');
    }
    
}
